 package org.mybatis.plugin;

public class SqlServerlIbatisDialect extends IbatisDialect
 {
   public boolean supportsLimit()
   {
     return true;
   }
 
   public boolean supportsLimitOffset() {
     return true;
   }
 
   public String getLimitString(String sql, int offset, int limit)
   {
     sql = " DECLARE @Start INT  DECLARE @End INT  SELECT  @Start =  " + (offset - 1) * limit + ",@End  =" + offset * limit + "  SELECT *  FROM (  " + sql;
     sql = sql + " ) T  WHERE RowNumber > @Start AND RowNumber <= @End  ";
 
     return sql;
   }
 }

